package com.xxxx.seckill.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xxxx.seckill.pojo.FailMessage;
import com.xxxx.seckill.pojo.Order;
import com.xxxx.seckill.pojo.User;
import com.xxxx.seckill.vo.RespBean;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author zhoubin
 * @since 2022-08-20
 */
public interface IOrderService extends IService<Order> {

    /**
     * 检查用户是否购买秒杀商品
     * @param goodsId
     * @param user
     * @return
     */
    FailMessage check(int goodsId, User user);

    /**
     * 下单
     * @param user
     * @param goodsId
     */
    Order order(User user, int goodsId);

    /**
     * 订单详情
     * @param orderId
     * @return
     */
    RespBean getOrderDetail(String orderId);

    /**
     * 生成 秒杀路径
     * @param user
     * @param goodsId
     * @return
     */
    String createPath(User user, Long goodsId);

    /**
     * 检查秒杀地址是否正确
     * @param user
     * @param goodsId
     * @param path
     * @return
     */
    boolean chechPath(User user, int goodsId, String path);

    /**
     * 检查验证码
     * @param user
     * @param goodsId
     * @param captcha
     * @return
     */
    boolean checkCaptcha(User user, Long goodsId, Integer captcha);
}
